<?php
session_start();
include("load-settings.php");

if(!isset($_SESSION['user']))
	header("Location: login.php");
?>
<!DOCTYPE html>
<html lang="en">
	<head>
		<title>Veteran Boosters Order Tracking</title>
		<meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<link rel="stylesheet" href="css/bootstrap.min.css" />
		<link rel="stylesheet" href="css/font-awesome.css" />
		<link rel="stylesheet" href="css/fullcalendar.css" />
		<link rel="stylesheet" href="css/jquery.jscrollpane.css" />	
		<link rel="stylesheet" href="css/unicorn.css" />
		<!--[if lt IE 9]>
		<script type="text/javascript" src="js/respond.min.js"></script>
		<![endif]-->
		<script src="javascripts/application.js" type="text/javascript"></script>	
	</head>	

<?php
	include("top.php");
?>
<div class="container-fluid">
<div class="row">
   <div class="col-lg-12 col-md-12 col-sm-12">
      <div class="box">
         <div class="box-header">
            <span class="title">Open tickets</span>
         </div>
         <div class="box-content">
            <table class="table table-bordered table-striped table-hover">
               <thead>
                  <tr>
                     <th>User</th>
                     <th>Order</th>
                     <th>Status</th>
                     <th>Actions</th>
                  </tr>
               </thead>
               <tbody>
			   <?php
					if($type != 2)
					{
						$result = mysql_query("SELECT * FROM ticket WHERE user = $user AND status = 0");

						while($row = mysql_fetch_array($result))
						{
							echo "<tr><td>".$row['user']."</td>";
							echo "<td>".$row['order_record']."</td>";
							echo "<td>Pending</td>";
							echo "<td><a href='ticket.php?id=".$row['id']."' class='btn btn-success btn-xs'>Details</a></td></tr>";
						}
					}
					else
					{
						$result = mysql_query("SELECT * FROM ticket WHERE status = 0");

						while($row = mysql_fetch_array($result))
						{
							echo "<tr><td>".$row['user']."</td>";
							echo "<td>".$row['order_record']."</td>";
							echo "<td>Pending</td>";
							echo "<td><a href='ticket.php?id=".$row['id']."' class='btn btn-success btn-xs'>Details</a></td></tr>";
						}
					}
			   ?>
			   </tbody>
            </table>
         </div>
      </div>
   </div>
</div>
</div>
</div>
<?php
	include("bottom.php");
?>